<!DOCTYPE html>
<html>
<head>
<title>教练管理</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<link rel="stylesheet" href="../../css/bootstrap.min.css">
<link rel="stylesheet" href="../../css/font-awesome.min.css">
<link rel="stylesheet" href="../../plugins/jqgrid/ui.jqgrid-bootstrap.css">
<link rel="stylesheet" href="../../plugins/ztree/css/metroStyle/metroStyle.css">
<link rel="stylesheet" href="../../plugins/datepicker/bootstrap-datetimepicker.min.css">
<link rel="stylesheet" href="../../css/main.css">
<script src="../../libs/jquery.min.js"></script>
<script src="../../plugins/layer/layer.js"></script>
<script src="../../libs/bootstrap.min.js"></script>
<script src="../../libs/vue.min.js"></script>
<script src="../../plugins/jqgrid/grid.locale-cn.js"></script>
<script src="../../plugins/jqgrid/jquery.jqGrid.min.js"></script>
<script src="../../plugins/ztree/jquery.ztree.all.min.js"></script>
<script src="../../plugins/datepicker/bootstrap-datetimepicker.min.js"></script>
<script src="../../plugins/datepicker/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script src="../../plugins/ckeditor/ckeditor.js"></script>
<script src="../../js/common.js"></script>
</head>
<body>
<div id="rrapp" v-cloak>

    <div v-show="showList" >
		<div class="grid-btn row">
			<div class="form-group ">
				<div class="input-group date">
					<div class="input-group-addon">教练:</div>
					<input type="text" class="form-control" v-model="q.coachName" @keyup.enter="query" >
					<div class="input-group-addon">课程名称:</div>
					<input type="s" class="form-control" v-model="q.lessonName" @keyup.enter="query" />
					<div class="input-group-addon">创建时间:</div>
					<input id="creadTimeBeg" type="text"  class="form-control "  @keyup.enter="query">
					<div class="input-group-addon">
						<span>-</span>
					</div>
					<input id="creadTimeEnd" type="text"  class="form-control"  @keyup.enter="query" >
					<div class="input-group-btn">
						<a class="btn btn-default" @click="query()">查询</a>
					</div>
					<div class="input-group-btn">
						<a  class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>
					</div>
					<!--<div class="input-group-btn">
						<a  class="btn btn-primary" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
					</div>-->
				</div>
			</div>
		</div>
		<table id="jqGrid"></table>
		<div id="jqGridPager"></div>
	</div>
	<div v-show="!showList" class="panel panel-default">
		<div class="panel-heading">{{title}}</div>
		<form class="form-horizontal">
			<div class="form-group">
				<div class="col-sm-2 control-label">课程名称</div>
				<div class="col-sm-10">
					<input type="text" class="form-control" v-model="lessonMaster.lessonName" placeholder="课程名称"/>
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-2 control-label">选择教练</div>
				<div class="col-sm-10">
					<button type="button" class="add-btn btn btn-primary pull-right" @click="addCoach">新增</button>
					<table  class="table table-hover">
						<tr v-for="(item,itemIndex) in lessonMaster.coachs">
							<td>
								<select type="text" class="form-control"   @change="onSelectedDrug($event, item)">
									<option >请选择教练</option>
									<option v-for=" (coach,index) in coachs" :value="index">{{coach.coachName}}-{{coach.coachId}}</option>
								</select>
							</td>
							<td><div >{{item.coachId}}</div></td>
							<td><div >{{item.coachName}}</div></td>
							<td> <button type="button" class="btn btn-danger" @click="removeCoach(itemIndex)">删除</button></td>
						</tr>
					</table>

				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-2 control-label">课程图片</div>
				<div class="col-sm-4 control-label">
					<input  id="file_upload" type="file" v-on:change="fileUpload()"></input>
				</div>
				<div class="col-sm-4 control-label">
					<img :src="lessonMaster.lessonPic" width="230" height="120" ></img>
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-2 control-label">注意事项</div>
				<div class="col-sm-10" >
					<textarea v-model="lessonMaster.lessonAttention" class="form-control"></textarea>
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-2 control-label">课程介绍</div>
				<div class="col-sm-10">
					<textarea id="lessonIntro" type="text" class="form-control" >{{lessonMaster.lessonIntro}}</textarea>
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-2 control-label"></div>
				<input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定"/>
				&nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
			</div>
		</form>
	</div>
	<div id="addLessonItem" style="display: none;">
		<div class="grid-btn row">
			<div class="form-group " v-show="showLessonItemQ">
				<div class="input-group date">
					<div class="input-group-addon">教练编号:</div>
					<input type="text" class="form-control" v-model="item_q.coachId" @keyup.enter="reloadItemGrid" >
					<div class="input-group-addon">课程时间:</div>
					<input id="lesson_item_beg" type="text"  class="form-control "  @keyup.enter="reloadItemGrid">
					<div class="input-group-addon">
						<span>-</span>
					</div>
					<input id="lesson_item_end" type="text"  class="form-control"  @keyup.enter="reloadItemGrid" >
					<div class="input-group-btn">
						<a class="btn btn-primary" @click="reloadItemGrid">查询</a>
					</div>
					<div class="input-group-btn">
						<a class="btn btn-default" @click="toggleQueryAdd">添加课程</a>
					</div>

					<!--<div class="input-group-btn">
						<a  class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>
					</div>-->
					<!--<div class="input-group-btn">
						<a  class="btn btn-primary" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
					</div>-->
				</div>
			</div>
			<div class="form-group " v-show="!showLessonItemQ">
				<div class="input-group date">
					<div class="input-group-addon">课程时间:</div>
					<input id="lessonBegTime" type="text"  class="form-control ">
					<div class="input-group-addon">
						<span>-</span>
					</div>
					<input id="lessonEndTime" type="text"  class="form-control" >
					<div class="input-group-addon">课程价格:</div>
					<input  type="text"  v-model="lessonItem.lessonPrice" class="form-control ">
					<div class="input-group-addon">课程人数:</div>
					<input  type="text" v-model="lessonItem.lessonMaxNums" class="form-control ">
					<div class="input-group-btn">
						<a class="btn btn-primary" @click="saveLessonItem">确定</a>
					</div><div class="input-group-btn">
						<a class="btn btn-default" @click="toggleQueryAdd">查询</a>
					</div>
				</div>
			</div>
		</div>
		<table id="lesson_item"></table>
		<div id="lesson_item_pager"></div>
	</div>

</div>

<script src="../../js/modules/sys/battalionlesson.js"></script>
</body>
</html>